-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[scudo] Skip test if mlock fails. #168448
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Some linux versions might not support the mlock call, so skip that part of the test if the mlock fails.
|
@llvm/pr-subscribers-compiler-rt-sanitizer Author: Christopher Ferris (cferris1000) ChangesSome linux versions might not support the mlock call, so skip that part of the test if the mlock fails. Full diff: https://github.com/llvm/llvm-project/pull/168448.diff 1 Files Affected:
diff --git a/compiler-rt/lib/scudo/standalone/tests/map_test.cpp b/compiler-rt/lib/scudo/standalone/tests/map_test.cpp
index afdfe5be85fb6..9d1a35c44679d 100644
--- a/compiler-rt/lib/scudo/standalone/tests/map_test.cpp
+++ b/compiler-rt/lib/scudo/standalone/tests/map_test.cpp
@@ -120,17 +120,17 @@ TEST(ScudoMapTest, Zeroing) {
#if SCUDO_LINUX
// Now verify that if madvise fails, the data is still zeroed.
memset(Data, 1U, MemMap.getCapacity());
- EXPECT_NE(-1, mlock(Data, MemMap.getCapacity()));
-
- EXPECT_EQ(1U, Data[0]);
- EXPECT_EQ(1U, Data[PageSize]);
- EXPECT_EQ(1U, Data[PageSize * 2]);
- MemMap.releaseAndZeroPagesToOS(MemMap.getBase(), MemMap.getCapacity());
- EXPECT_EQ(0U, Data[0]);
- EXPECT_EQ(0U, Data[PageSize]);
- EXPECT_EQ(0U, Data[PageSize * 2]);
-
- EXPECT_NE(-1, munlock(Data, MemMap.getCapacity()));
+ if (mlock(Data, MemMap.getCapacity()) != -1) {
+ EXPECT_EQ(1U, Data[0]);
+ EXPECT_EQ(1U, Data[PageSize]);
+ EXPECT_EQ(1U, Data[PageSize * 2]);
+ MemMap.releaseAndZeroPagesToOS(MemMap.getBase(), MemMap.getCapacity());
+ EXPECT_EQ(0U, Data[0]);
+ EXPECT_EQ(0U, Data[PageSize]);
+ EXPECT_EQ(0U, Data[PageSize * 2]);
+
+ EXPECT_NE(-1, munlock(Data, MemMap.getCapacity()));
+ }
#endif
MemMap.unmap();
|
🐧 Linux x64 Test Results
|
|
Thank you for the fix! |
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/174/builds/27620 Here is the relevant piece of the build log for the reference |
|
Thanks, this makes the tests pass for me. That said, I don't think it's a matter of "linux version" — I've reproduced it 6.12.53 and 6.17.3, on amd64 and arm64, in nspawn containers. My guess would be permissions or something else. |
Some linux versions might not support the mlock call, so skip that part of the test if the mlock fails.